<template>
	<view class="p20">
		<view class="pt40 flex row-center">
			<imgList hide @setImg="e=>{form.avatar_img=e.path,form.avatar=e.id}" ref="img" />
			<u-avatar :src="form.avatar_img||''" @click="$refs.img.upImg('setImg')" size="130" show-level
				level-icon="camera-fill" />
		</view>
		<view class="mt70 bg-fff radius20 pl20 pr20">

			<view class="flex pt20 pb20 border-b" v-if="!(item.identityHide.includes($user.identity))"
				v-for="(item,index) in list" :key="index">
				<view class="color-666 ">{{item.name}}</view>
				<u-input v-model="form[item.fidle]" :disabled="item.disabled" :type="item.inputType||'text'"
					:placeholder="`请输入`+item.name" inputAlign="right" :clearable="false" class="tr flex1 ml20" />
				<u-icon name="arrow-right" class="ml10 pe-none" v-if="item.right" />
			</view>

		</view>
		<view class="h120"></view>
		<view class="pf bottom0 left0 bg-fff w-max">
			<view class="p20">
				<u-button type="warning" ripple @click="submit">保存修改</u-button>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: [{
					name: '姓名',
					fidle: 'name',
					right: true,
					identityHide: [''],
				}, {
					name: '年龄',
					fidle: 'age',
					right: true,
					inputType: 'number',
					identityHide: ['organ'],
				}, {
					name: '身份证号',
					fidle: 'card_no',
					right: true,
					identityHide: ['organ'],
				}, {
					name: '手机号码',
					fidle: 'mobile',
					disabled: true,
					identityHide: [''],
				}, {
					name: '护龄',
					fidle: 'service_year',
					right: true,
					inputType: 'number',
					identityHide: ['organ'],
				}, {
					name: '家庭住址',
					fidle: 'address',
					right: true,
					identityHide: [''],
				}, {
					name: '个人简介',
					fidle: 'profile',
					right: true,
					identityHide: [''],
				}, ],
				form: {
					avatar: "", //	整型	非必填	-	-	头像
					avatar_img: "", //	整型	非必填	-	-	头像
					name: '',
					mobile: '',
					age: '',
					card_no: '',
					service_year: '',
					address: "", //	字符串	非必填	-	-	住址
					lng: "", //	字符串	非必填	-	-	经度
					lat: "", //	字符串	非必填	-	-	纬度
					profile: "", //	字符串	非必填	-	-	个人简介
				}
			};
		},
		onLoad() {
			for (let key in this.form) {
				this.form[key] = this.$user[key]
			}
		},
		methods: {
			submit() {
				this.$request('/master/my/editInfo', this.form).then(res => {
					this.$msg(res.msg)
					setTimeout(this.$navBack, 800)
				})
			}
		}
	}
</script>

<style lang="scss">

</style>
